<?php

namespace app\admin\controller;

use app\admin\model\User;
use think\Controller;
use think\Request;


class Auth extends Controller
{
    /**
     * @return mixed
     */
    public function index(){
        return $this->fetch('view/index');
    }

    /**
     * @return \think\response\Json
     */
    public function login(){
        $user = new User();
        // 获取当前请求的所有变量（经过过滤）
        return json($user->checkLogin(Request::instance()->post()));
    }

    /**
     * @return \think\response\Json
     */
    public function register(){
        $user = new User();
        return json($user->checkRegister(Request::instance()->post()));
    }

    /**
     * @return \think\response\Json
     */
    public function email(){
        $user = new User();
        return json($user->checkEmail(Request::instance()->post()));
    }
}
